//
//  HFOrnamentView.m
//  HocusFocus
//
//  Created by Drew Davidson on 6/10/10.
//  Copyright 2010 Apple Inc. All rights reserved.
//

#import "HFOrnamentView.h"
#import "HFOrnament.h"

@implementation HFOrnamentView

@synthesize ornament;
@synthesize selected;

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        selected = NO;
    }
    return self;
}

- (void)drawRect:(NSRect)rect
{
    NSRect br = [self bounds];
    NSRect r = NSInsetRect(br, 10, 10);
    NSBezierPath *backgroundPath = [NSBezierPath bezierPathWithOvalInRect:r];
    
    if (self.selected) {
        [[NSGraphicsContext currentContext] saveGraphicsState];
        [backgroundPath setLineWidth:0.025];
        NSShadow *shadow = [[[NSShadow alloc] init] autorelease];
        
        [shadow setShadowColor:[NSColor whiteColor]];
        [shadow setShadowBlurRadius:10.0];
        [shadow setShadowOffset:NSMakeSize(0.0, 0.0)];
        [shadow set];
        [[NSColor whiteColor] set];
        [backgroundPath fill];
        [backgroundPath fill];
        [backgroundPath fill];
        [[NSGraphicsContext currentContext] restoreGraphicsState];
    }
    
    [ornament drawInRect:NSInsetRect([self bounds], 10, 10)];
    [super drawRect:rect];
}

@end
